package com.zjsru.dailytest;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @Author: likew
 * @Date: 2022/7/20
 */
public class combination {
    public static String combination(int[] nums) {
        String[] numStrArray = new String[nums.length];
        for (int i = 0; i < nums.length; i++) {
            numStrArray[i] = String.valueOf(nums[i]);
        }
        
        Arrays.sort(numStrArray, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return (o2 + o1).compareTo(o1 + o2);
            }
        });
        System.out.println("numStrArry"+Arrays.toString(numStrArray));
        String str = "";
        for (String s : numStrArray) {
            str += s;
        }
        return str;
    }
    public static void main(String[] args) {
        System.out.println(combination(new int[]{50, 20, 1, 9, 7}));
    }
}
